import request from '@/utils/request'

// 登录
export const login = data => {
  return request({
    method: 'POST',
    url: '/login',
    data
  })
}

// 根据用户id查询地址
export const searchAdd = id => {
  return request({
    method: 'GET',
    url: `/address/page/${id}`
  })
}

// 地址修改事件
export const editAdd = data => {
  return request({
    method: 'PUT',
    url: '/user/update/user',
    data
  })
}

// 查看所有用户,管理员转用
export const getSomeUser = params => {
  return request({
    method: 'GET',
    url: '/user/all',
    params
  })
}

// 修改商家、

export const editShang = data => {
  return request({
    method: 'PUT',
    url: '/user/update/seller',
    data
  })
}

// 根据id查询用户所有数据
export const getOneUser = id => {
  return request({
    method: 'GET',
    url: `/user/search/${id}`
  })
}
// 修改用户个人·信息
export const editUserp = data => {
  return request({
    method: 'PUT',
    url: '/user/update/user',
    data
  })
}
export const editUserbyadmin = data => {
  return request({
    method: 'PUT',
    url: '/user/update/admin',
    data
  })
}
// 商家注册实际
export const Sregister = data => {
  return request({
    method: 'POST',
    url: '/register',
    data
  })
}
// 根据id删除用户
export const deleteUser = id => {
  return request({
    method: 'DELETE',
    url: `/user/delete/${id}`
  })
}
// 根据用户id删除地址
export const deleteAddress = id => {
  return request({
    method: 'DELETE',
    url: `/address/delete/${id}`
  })
}
// 修改地址信息
export const updateAddress = data => {
  return request({
    method: 'PUT',
    url: '/address/update',
    data
  })
}
// 增加地址
export const inputAddress = data => {
  return request({
    method: 'POST',
    url: '/address/add',
    data
  })
}
